<template>
	
	
	<view class="content">		
		
		 <view>
		        <view class="uni-padding-wrap">
		            <view class="page-section swiper">
		                <view class="page-section-spacing"  >
		                    <swiper class="swiper" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration">
                            <swiper-item v-for="(item, index) in items">
								<image class="logo" :src='item.url'></image>
							</swiper-item>
		                </swiper>
		           </view>
		        </view>
		 </view>
				
				
		<uni-list v-for="(jet, index) in objet">
			<uni-list-item :title="jet.title" :note="jet.time" link @click="onClick(jet.id)"></uni-list-item>
		</uni-list>

				
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				indicatorDots: true,
				autoplay: true,
				interval: 5000,
				duration: 500,
				items: [
					{url: '../../static/images/elmlq.png' },
					{url: '../../static/images/elmlq.png' },
					{url: '../../static/images/elmlq.png' }
				],
				objet: []
			}
		},
		onLoad() {
           this.httpList()
		   //this.httpImages()
		},
		onPullDownRefresh() { //下拉刷新
		        setTimeout (() => {
					this.httpList();
		            uni.stopPullDownRefresh();
		        }, 1000);
		},
		methods: {
			onClick(e){
				uni.navigateTo({
					url: '/pages/index/workDetails'
				});
			},
			httpList(){ //请求列表 
				let token = uni.getStorageSync('token');
				uni.request({
				    url: this.$httpUrl +'/index/index/newlist', //仅为示例，并非真实接口地址。
				    method: 'POST',
					header:{
						token: token
					},
					data: {
						pages: '1'
				    },
				    success: (res) => { //请求正常
						if(res.data.code == 0){
							this.objet = res.data.data.newList
						} else {
							this.$uniApi.open(res.data.msg)
						}
				 
				    },
					fail: (res) => { //异常
						this.$uniApi.open(res.data.msg)
					}
				});
			},
			httpImages(){ //请求轮询图片
				var token = uni.getStorageSync('token');
				uni.request({
				    url: this.$httpUrl +'/index/index/newlist', //仅为示例，并非真实接口地址。
				    method: 'POST',
					data: {
				        token: token
				    },
				    success: (res) => { //请求正常
				     console.log(res.data);
						if(res.data.code == 0){
							
							this.items = res,data.data
						} else {
							this.$uniApi.open(res.data.msg)
						}
				     
				    },
					fail: (res) => { //异常
						this.$uniApi.open(res.data.msg)
					}
				});
			}

		}
	}
</script>

<style>
	
</style>
